a bit less hacky code
Revert "a bit less hacky code"

This reverts commit d6469279925b964caa26ca12765ecd88f3858de5.
Revert "Revert "a bit less hacky code""

This reverts commit 456befdd4febb4feee94e2bfe66fc8c50b1e136c.