Start of refactoring to make it more practical to use