Refactored sorts into classes