refactor index and layout page