Implemented the sort by code through weight feature