Extract modal and tiles creation logic into their own factories.