refactor marker logic