Added more checks and safeguards to calc

Added more checks and safeguards to calc. Should only work with numbers
and certain symbols to prevent execution of arbitrary code