Added a GRE check.

Added a GRE check and cleaned up more of the sample I plagiarized to
create this sample.
Cleanup

A little more in the comments, some extra line breaks for readability,
etc.