Started work on input handling and refactoring the pattern editor control