Simplifying javascript.