Refactored more, fixed test case again.