Added more input data validation and error handling
Merge pull request #44 from Atheros1/master

Added more input data validation and error handling