Added basic program validation and error reporting