opimizing the code.