updated test and code