refactor wrap