Revert "Refactore code - rearrange code blocks"

This reverts commit efe53b95b3c3af3cc1ac9b2e492ada5d0ea93a82.