Code Cleaning and debug Courtesy  of Mr. Gianordoli.