Makefile refactoring
Restore global function definitions in JS
Remove prerequisite loading from the makefile

This is no longer required with global function definitions in JS.
Restore tests