Added some much needed comments, changes options to options_t to avoid confusion. Fixed exit_clean() to close log file last