rewrite with lazy sequence