moved stuff around for this to be a separate library
Library-afying. I know it's terrible, I need to read a JS book...