Refactored the deep nesting.
Added nested class example (thanks @krestenkrab).