Minor style changes
Refactor validation logic