Cleaned up some javascript to be able to understand it + make further updates

First time in years I've felt confident about organizing javascript code.

Babel, Webpack, all of it still feels like magic to me - especially the amount of tiny tiny packages with tiny tiny configs that generate a tonne of warnings on package updates.