Would be better to avoid this code duplication