changes to the logic