improved generator functions