Update LICENCE
Refactor error handling