many improvements / optimisations