cleaned up main (cont.)