Some errors with command substitution vs. "puts"  were corrected.