Cleaned up code and Fixed Config File Loading