Working on generating segments file. Still some issues to work out. But the core is working.