newest version with arrays added