improved speed and logging