messy but functional code
Cleanup
Cleanup
All working
All done