Initial checkin of model logic