Cleaned up code and made everything object literal