updated main js (big update)