Restructed to reduce unecessary datastore reads