Refactor upstart script.