some code improvements