Refactor layout and routes