Added some comments.
Also simplified the expression used to extract the available versions.
Now using a single sed statement to match and capture.