working example, using arrays