added test and use interface for sorting