refactored main js, updated variable names