Cleaned up Javascript