adding comments, formatting, and a missing call to the revstr function
adding comments to revstr js