Replace some before blocks with let statements
Replace before block logic with let statements