some first code cleaning, fixing
another code imporvments