honors REP 117 reference implementation

by checking for valid values
Merge pull request #2 from efernandez/rep117_check_for_valid

honors REP 117 reference implementation