Added replace attribute functionality.