Merge pull request #35 from michalt/semilinear

Cleanup and minor fix
WIP