added invoice model, some first refactorings/generalizations