Used anonymous function encapsulation in order to keep the setRet closure static while preventing its recreation on every call
Moved gamemode-fetch lines to just above where they are needed in order to reduce unnecessary calls to gmod.GetGamemode when gamemode hooks are overridden