yorisimo, that's why the ScanMessage thing was implemented. So the engine can handle incoming messages and than pass them to the SM func.

Just define the function like I've done, it should work well.