Fixed some errors with headers and improved the CMakeLists