revised code for testing