refactor FileSource for deferred loop initialization