code improved as part of testing