Just refactored to make this easier to use