Did some memory optimisations