Refactored some code and move FileManager out of mri_scanner