updating with Murtada's version