Refactored code; clean config