Added test and sorted output