merge duplicate function