Moved out function definitions