Updated to check existence with key and rev