EDIT: originally I had a comment about the incongruity between Spriggsy's code and code output snapshot. The output did not come from the code as shown. I had assumed it was and made comment about that, then I saw what he was doing and said "never mind" because I picked up what he was trying not to print. Then he explained that and now we pickup from there....
A+ for that!
All these API's you are posting, did you pick those up from your job?
Those seem like handy things for business.