edited wx tiles function