Refactoring to be more wrappable