revised code for test