Clean up $self definition and static calls.