First version of lib.

Fixes #1