fixes to calcdistances for genes, reactions, roles; includes updated cof...

Merges updated code for calcdistances onto the master branch