firebase and backend work with algorithm