Use conditions instead of nesting hondlers