Cleaned up some of the parsing code.