remove unused variables and avoid initialising mG twice