Removing unused code, moving add/remove classes to jquery