Refactored to make instantiating Header objects easier, and avoiding unnecessary code duplication.
Made helper functions private
Added parsing of segment number