remove unnecessary element and rules