added logic to model