Improved sorting sample code. Issue #11