Refactored and added tests for responses