Could you also check if selectLastFile() still make sense?
Does it already behave properly without it?