Added validity checking code
Fixed syntax error
Added helpful terminal output