Added cleanup to function.
Merge branch 'test' into dev