Reduce duplicate code for tiles