Refactored and deleted test code