streamline legend drawing for markers, remove much duplicate code