Fatal errors are reported + code cleanup
Add tests