Moving "private" methods to own private.js file

I want to move all these private methods to their own file, so I can sandbox them and access via tests.

This is purely so I can write unit tests for them.