optimize firebase