fixed all firebase functionality and cleaned up code