make some code improvements