implemented parse function; added query in counts