Split out some of parse.R into clean.R