continued.
changed some stuff to correct bash syntax.
checking if packages.lst exists before trying to access it.
corrected some mistakes
added function to clean up.
corrected formating.