Revert "refactor code"

This reverts commit 510c747a79846eb9d32a392c153fd0aa2948f261.