Adds metaprogrammed validation and cleans a bit.