Updated to SMF code

Primarily SMF source code with modifications.