wrote tfs_to_patch
replaced checked by real grid calculation, refactored code