Refactored a lot. Introduced custom model logic