started to convert code to use arrays