Code for post queries