Add error type and remove some TODOs