Sort numerically.

Refactors sort method to make it testable and added tests.

Added number detection.

Closes #211