minor validation logic fix
minor refactoring