Clean up script a bit. Preparing for sorting and progress display.