Updated code to work with Processing 2.x