refactored design (tests on categorical and gauss passed)