added some event listeners and new functions
created separate js files