Clean up the parsing code