Minor changes based on code inspection.
Use def-kom-command when possible, made some code more robust, Added utilities file and moved certain functions there. Removed lots of emacs 18 compatibility. This type of code will have to go into special compatibility files later on. Got rid of all the compiler warnings I could. Other minor changes (see ChangeLog)