Cleaned up code and fixed path to config file