Code refactoring done. Refactored the two render functions in the app presented into one.