Refactor read functions