improve the code, remove unnecessary restrict