Cleaned up JS and fixed most all bugs