Doxygen code documentation

see issue #47

main.c and prefs.c to go. Does any1 want to take that over?