Changed Exception to more specific Exceptions.