Queries f and g added