Simplify and remove unnecessary function.