Function logic changes