trying to improve some code.