adding tile extraction function