added ami's code