Deleted unused variables y and g.