Basic segmentation and desegmentation working
needs some cleanup refactoring still