added code for #9