Format of code corrected and small mistakes