Refactor to introduce a class to manage source files