Revised some logic…still work in progress