Reworked '=' foreign function