Untested, just so you can see. You already did this parsing, but I wrote it before I saw yours.