cleanup in main method