Cleanup, moved unused code to a class in test