Refactor & coded
Coded for basic
After refactoring