split off file management into mixin.