moved argument validation into a function. prettified output.