refactor reading to avoid custom logic for nullables