code improved3