Fix a potential NPE
Collapse if-statement
Extract tile-filtering methods from LogicHandler