added decay function to our algo

removed the complex main to be something simpler