pep8 file
optimize() specify max_segments, rename params to be more consistent