to replace the following function.