Refactored code and restructured interface