Update to the styles. Refactored sorting function code.