some code improvements

some code improvements