Added segments options / plus some optimizations