Fixed some arraylist issues

arraylist issue fixes and comments added