Performance optimisations. 66 s -> 47 s