Fix regression in annotation icon placement and refactor some recently committed code.