Minor refactors to test cases and logging improvements