some cleanup in main script