changed function order to counter resolve issues.