changed function order