replace mysql with queryDB(), and various other adjustments