simplified code that automatically sets the span