Working version

Used console.log output for sorted list