slight algorithm updates