creating script for querying by user