fleshed out structure of main