more cpp implementation