built listener structure to pull db updating code out of the view layer