added some comments to code. Attempted to shorten jQuery code but it didn't really work.