add unprocessed check
add phase 3 of algorithm
it kinda works