refactor boxing