Cleanup tests code a bit