refactor with errors partial