webtest code improvement and cleanup

removed unwanted '^M' symbolic characters present in file and used helper functions