updated code for last merge