Adding logic

merging the addition of validation logic to master