Refactoring. Migrate to cmake.