webtest code improvement and cleanup