finally fixing validation - it's a mess, but it's working on a first
look