refactored error message generation, but not working
re-added function constructor
bug with !x$passed, presumably due to !passed