code cleaning, style improvements