complete adding and querying