Refactored exceptions.
InvalidArgumentExceptions fixed.
Merge pull request #151 from xi-project/exceptions

Exceptions