cleaned up tests code a bit