code and algorithms 4581866