Applied some optimalisations