changed first alert to work with arrays