refactored initialization logic into model.js