Minor fixes
Added custom exceptions