Some alogrithms