algorithm done!
now just need to code this
hmm maybe tomorrow