refactoring to main.js
started work on form functionality