make it work with arrays