Unreferenced variables if you pass certain parameters.  Also handling closing of open files and removing internal todo