Database and query methods built.