Added conditional checks for parameters