added second logic