Clean up and namespace function