additional algorithm improvement