Refactoring to make it easier to use