improved javascript performance