Reorder the code. Inline dispatch function for faster performance,
state initialization is now done when creating SPM object structure.