renamed variables and changed regex creation