trace algoritm

I'm actually kinda surprised by how this worked well. It