removed some unnecessary nesting