working algo, nearly beta version
Beta v0.1