Updated the logic preliminary