Backtracked and rewriting of firebase stuff