Revert "refactor a bit"

This reverts commit f5560244a86a17a900864fa106c3147b7f166027.

These changes are incorrect.