beginning to handle errors
Merge pull request #5 from omoss/error-handling

adds basic error handling