code cleaning, plus some minor stuff