Revert "Code refactoring"

This reverts commit 96813bc1af545577f6e910d86b8dc8421b0e4c4a.