refactored file handling, split out mask earlier

this’ll help when working through big files as the current plan is to
start at 0 and shove things in buckets.
ignoring the pycharms project folder