added parameter checking to define