Added --clean option and better ephemeral directory handling