Improved way of checking for testing mode