refactor(error): cleanup & external state