some tidying of maingui