finish main method