Reordered directory structure

Moving to CMake is pending.
Add main() declaration
Add cmake support

This is very lazy cmake rules and I think it can be better.