Refactor embedlite to control startup/shutdown process better