modified methods to now accept input as ArrayList<String>