change the parameters a little bit to make the code more flexible