Added a new perrorMsg function, cleanup up error handling, fixed TRUE/FALSE