Error handling for all functions
Merge pull request #16 from CodexVII/master

Error handling for all functions