Revert "completed refactoring"

This reverts commit 80711fc92b30b046170609dec400a72959a522d7.