Clean and fixes to scripts