Changed to reduce memory usage