refactor to incorporate firebase

in need or a reorg