Error entity refactor