var ROWS = 20;
var COLS = 10;
var SIZE = 32;

var canvas;
var context;
var currentBlock;
var lineScore;

$(document).ready(function(){

	canvas = document.getElementById('gameCanvas');
	context = canvas.getContext('2d');
	lineScore = $('#lines');

	function initGame() {

	var row, col;
	currentLines = 0;
	isGameOver = false;

	gameData = new Array();

		for(row= 0; row < ROWS; row++) {
			gameData[row] = new Array();
			for(col = 0; col < COLS; col++) {
				// gameData[r].push(0);
				gameData[row][col] = 0;
			}
		}

	currentBlock = getRandomPiece();

	var requestAnimFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
			window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;

	window.requestAnimationFrame = requestAnimFrame;

	requestAnimationFrame(update);
	}
});

function getKeyCode(e) {
	// if(!e) { var e = window.event; }

	e.preventDefault();

	if(isGameOver != true) {
		switch(e.keyCode) {
			case 37: {
				if( checkMove(currentBlock.gridX - 1, currentBlock.gridY, currentBlock.currentRotation) )
					currentBlock.gridX--;
			}
			break;

			case 39: {
				if( checkMove(currentBlock.gridX + 1, currentBlock.gridY, currentBlock.currentRotation) )
					currentBlock.gridX++;
			}
			break;

			case 38: {
				var newRotation = currentBlock.currentRotation - 1;
				if(newRotation < 0)
					newRotation = currentBlock.rotations.length - 1;

				if( checkMove(currentBlock.gridX, currentBlock.gridY, newRotation) )
					currentBlock.currentRotation = newRotation;
			}
			break;

			case 40: {
				if( checkMove(currentBlock.gridX, currentBlock.gridY + 1, currentBlock.currentRotation) )
					currentBlock.gridY++;
			}
			break;
		}
	}
	else {
		initGame();
	}
}


@@ -546,13 +546,13 @@
 ndom
-Piece
+Block
 ();%0A
@@ -955,37 +955,40 @@
 e 37: %7B%0A%09%09%09%09if( 
-check
+validate
 Move(currentBloc
@@ -1109,37 +1109,40 @@
 e 39: %7B%0A%09%09%09%09if( 
-check
+validate
 Move(currentBloc
@@ -1398,37 +1398,40 @@
 h - 1;%0A%0A%09%09%09%09if( 
-check
+validate
 Move(currentBloc
@@ -1565,13 +1565,16 @@
 if( 
-check
+validate
 Move

Change check move function to reflect desired actions