Adding cmake building + minor re-structuring
Resolve merge problems