updated code rev3