finished first version of main