Some optimizations to tests