Added Init function, working on run SM function