Refactor errors decl and update interfaces