[RR-8] fixing bugs and formatting the files