minor modifications to structure of main