Improve some code