Revert "Ugly code!"

This reverts commit 2b972bb182e3fc89a8cd9cb75fcfe96187387b0c.