optimize list_cleanup routine