* split out library
* fixing warnings and code style