Various Javascript enhancements