Cleaned up duplicate code

-duplicated test functions moved to new tests.js file
-added in comments describing settings in variables