second commit

cut down some of the queries, database connection now in a constructor