simplify, change array to arraylist