remove jquery $ and clean up code