moved around a lot of javascript; removed unnecessary overhead in server