Refactor to abstract the key from datastore