Added proper Firebase event listener and decoding logic