code refactor, support landscape mode