cleaning code
beginning of hsb func