created algorithm based off of zethos