shape classes: more rigid typechecking, cleanup