improvements in the core loop