Rewrote (valid-card) to be more readable