optimized branching a little