Optimised some code