Refactor Code for Interfacing with other tools

Refactored code for interfacing with other tools.