Added some logic