Revert "Refactor the code a bit to make it more readable and clean."
This reverts commit 78420f588cc018f377f3d71c70ebf9efb5e7fd6e.