cleanup of code now using a single variable and decrease of timeout