Updated some logic