using db instead of fixed vars