Added some missing logic