Added headersize argument in constructor, since the field is used during construction