Overall this file is barely understandable. You should really improve variable naming, add comments, split large methods, and reserialize async calls to improve readability, or any bug taking place in this file will be impossible to fix.