description of how algorithm works