Introduced proper error handling, added locationType into response