verious code improvements