Put in a validity check and some useful return values