sets up db queries for open and closed points