Added inBounds(int x, int y) function