manage mainApp properly with header and footer