Fixed layout and cleaned up firebase code