moved some JS around...still need to refactor