UPDATED CODE