Fix throwing of exception
Add example of usage