more general refactoring
Merge pull request #5 from nadavmatalon/model

more general refactoring