jsh with improvements from recitation