Add segment functionality and warnings.
Merge pull request #1 from zhelu/master

Add segment functionality and warnings.