Common algorithms implementation