Fix for issue 144 and cleaning

Fix for #144 when the user has no data, scope.gde_name remain empty so it's saved empty and so on...

While at it, found a block of code repeated, cleaned up and moved to a function