some optimisations
optimised some more