a few code improvements