Add LCA code and tests