Upgrade validation code to generics and default imports