cleanup JS and get post working correctly