Refactor The rest ans esync solution