Revised code to be as minimal as possible

Took a bit, but I think I've refined it to be as simple as I can make it! :palm_tree: