Modified data structures and added a CMakeLists

The CMakeLists is specific to my config for now.
Please modify it accordingly.
It will generate shared library.