fix proper response, minor code cleanup