Add phpdoc and custom exceptions