issue-4: moved validation out to its own class