significantly improved javascript