Improve test routine