Comment code cleaning and bug fixes