All features working. Refactored code for readability