Small refactoring plus validation introduction.