refactored database reads with iterables