Banish magic numbers from calculate_segment()
Create segment dict using an iterator
Default values in segment allocation function
default args & rearrange order of args in allocate_segment() + callers
Updates tests to match API changes