re-organize code
re-organize code