reworked logic to be more async