Add error check for common misuse, change trap argument order and make it padd callback to calling function. 'run' functon now also catches errors.