Refactored sort visualization to be used as a library.