i-MSCP daemon: Refactoring + CS fixes + small fixes (first part)