began scoping out the algorithm