Add Context object to hold in-scope vars, rework if checks accordingly with copious use of clone, and finally add support for handling different filetypes