Implement custom exceptions, fix some CS