Adding state error handling, allow to unit test both raw and minified version.