Replaced calls to table.getn() with the length operator '#'... table.getn is depreciated and is not support in versions of lua > 5.1