refactored back to use classes