Refactor full stack