Moved models to separate module & refactored code