minor cleanup of cpp code