Added config file code
Removed testing main, cleaned up some warnings and minor bugs