Refactored and Fix list sort arrows

Refactored duplicated code and fix incorrect display in firefox.