cleanup to support multiple inputs