refactor gridx gridy