make Android C++ compilable
refactoring