Changed tmp variables to temp