Re-wrote the programs