further javascript optimizations