- changed algorithm