updated code after merge