Makes validation functions private
Extracts validation into a separate function