Fix for error on line 287

"attmept to index globbal 'elements' (a nil value)" 
Changing "elements" to "self.elements" fixed that.