Optimise the Code

Optimise the Code