refactored back to make it work again before make some changes.