remove duplicate declaration
start clean-up of sort functions