updated code for 2