refactored getSpan