improved speed a bit