Overhaul lister.php to a higher standard and for PHP5