cleanup and remove redudant code