addClass and removeClass now check whether the class is already applied first