Fixed bug for valid test cases
Made the logger DRYer