cleaning up the js and some slight performance boosts