update to parameter names and use of logical and.