Some small code improvements