More work on refactoring and cleaning up the JS asset library. Cleaner functions.