added argument validation, error checking