updated code as on 20-may-2013