moving chat and firebase code to delegate classes