Final Fixed to the LOGIC. Everything should work