LOGIC WORKING