Revert "Refactor code"

This reverts commit 727317463a17ac5eb435d8ade9c7463c9ce2c552.