Some fixes.
Started library implementation.