Refactored to use object classes