Added generic scanTile() function.