Refractured jQuery around the javaScript to include .click functions