merge with kevin's code (again)