Move reading notes into a separate function