Yes, I think so. 
I have optimized these codes too.
Thanks!