Refactor to create external helper file to hold shared functions/vars
Rewrite check open statement to check for contains
Add wait in different area for consistency
Refactor tests to be less intensive