performance improvement: remove unused markers beforehand