Quick sorting method