refactored some external dependencies out