The arguments device and status have local scope inside the function and will hide any global variables of the same name. The values of these arguments are determined by what is passed in when the function is called. I might be able to help more if you post your code.