first level refactor