Don't use intermediate arraylist