Fix major bug in array intersection
Updates to db class