[WIP ]Refactor backend