Refactored mark_read out to its own function