refactored code. fixed bugs. reotated view 180deg~