Reorganizing some of the core loop