Optimise the code logic. Make more sense.