some code improvements.