Refactored getting body length to its own method