various minor code improvements