Simplify setRes() and getRes() by using arrays instead of math. Thanks to @gfwilliams for a hint on this one