shifted logic to functions