[TEST] improve code, and make it logged