working changed code