Refactor C++ code

Split features into their own file

Style is becoming less C, more C++