correcting nesting