creation of invoice model, with many refactorings