Changed config format and refactored some code