fixed the nesting and ready for code review