add recursive file task and code refactoring