Eliminate code duplicate