Simplification

Made the javascript cleaner, more efficient.