Finally got the 'laporder' function working.