organized routines into new files and added doxygen comments