added validation, error output