The structure could be even simpler. Also added some beauty to the presentation.