The code works, except that I need to change the parsing around a bit.