Minor updates
Add tests and change error format