refator comtinue
refactor 70%
Add code on server_main