general cleanup in main