Work-in-progress
Refactor for cleaner code