Some speed improvements and addition of switch function for diffusion of substances