Rename files in code folder and fix a bad refernce call in average patch algoritm