refactored model and added migration