finished main part of ex18