Typical algorithms implementation