refactor append