Extending mainpage example

I just merged #114 ... using that should simplify this part of the code a bit, no?