Rewrote DB access code as a class and incorporated class in various
locations. Still haven't used it in the web code, or in the old analysis
code, will rewrite when necessary in those locations