clean up of mainpage code