changed variables from arrays to arraylist