Refactoring existing code for new srpy driver