Mod: moved some code.