shorten some code

shorten some code