Revert "Refactor code"

This reverts commit 77bc1209c19e7acb10a537fe99c377eb4d2861c7.