Cleaned up some javascript