[UPDATE] split library into separate files. WIP.