string merging and better parameter checking