updated marking logic