LCS

Fixes #312 and #157