moving JS to firebase spearte file