refactor invoice