Implemented response construction and big refactoring.