Cleaned up JavaScript a bit.