Janky module system works in require() and injectJs()

Separated generic object functions into own file