Improved sorting.
Removed temporary file.
Removed duplication, implemented ajax task update.