refactor valid
rewrite to_s to be clearer
tests