Add function to set square state.