You should place this code into a default prelude hook (have a look at the other modules). It's not a good idea to add lambdas in hooks, because you can't really remove them afterwards and you can also end up adding the same lambda several times.