simplifying model and various other fixes & refactoring