Alter local to use same techniques as firebase code making it virtually the same