fixing & cleaning code