Added basic exception catching so that bad expressions are passed rather than let them terminate the program