refactored up to generating files