Updated Salman's code