implemment model logic