Big refactor to have embeded server