slightly improved control flow