Work in progress

query for getting pin IDs is fixed