Universalized 'code' function