Fixes to ES refresh logic & better thread and timeout settings for running JUnit tests.