Converted device functions to use 1d rather than 2d arrays