Improving code for mod_finder