dealt with shallow nesting by copying solutions