Make servie more hard for system to kill; Refactored code