Added more specific exceptions to increase control outside module.