Replace square.attr call with removeClass/addClass