Commented algorithms. Removed unused code.