algorithm improvement