introduced cleanInvocations method