improve some code