Minor parsing improvments and code cleanup