no idea what I achieved here
Split javascript into more manageable chunks