Fixing a merge problem and adding validation code