code refactor, make orientation chaged success