refactor unnested