small refactor + new error class