added data model, input checking