Switched a few things to generators for improved performance