Refactoring and abstracting for wider use