updated implementation