Revert "Refactor code"

This reverts commit 5250c9b5320e435f135966149703342e561428fd.