refactoring invoice