Fully implemented the span query
updated comments/documentation