Partially tidied allmain.c