Refactor File/Env logic to a more AOP fashion