Updated contract logic to function correctly