Added a main module

refactored random inline js into the main module.