few code improvements