Removes uneccessary setImmediates