Cleaned up/streamlined a lot of javascript.