added algorithmic functions