Refactored content-length stuff