Made the replaceTile methods slightly smarter