improved gene distances pipeline by abstracting out terms