Clean up some duplicated code in POS analyzer.