Cleaned code, found mistake in response handling