added parentScope to functions