fixing bugs in main js
merging changes
small array var in wrong place