I benchmarked the code with your modifications and the time taken drops from 50 seconds to 30 seconds which is pretty good. I need to look into the stuff provided by the SRFIs to see if they can help me write more idiomatic scheme.