Some code tidying. Also fixed a bug with the tile cache where it was causing all areas in the search box to have the same result.