Fixed nesting issues