Refactored and split response into header and body