Minor refactoring

@pocho23 review and merge. No changes in logic