refact mjmainsrv