Clean up and migrate functions from smp core lib.