improve algorithm a little bit