Fixed bug in segments adding
Cleanup