mostly refactored forall