Added some optimisations