Some minor code improvements