core library for https://github.com/mpetris/catma