removed bad error func, wrote queries