Refactoring to allow non-file source inputs