Read this thread for what Mart suggested we do - "I'd say go for creating a table for now as I described before. The idea may well be refined later, but that'll work well enough for now and it'll be pretty easy to change it later if need be... The shorter the code in generic.look the better. I realize that the front-page userpics are in index.bml rather than global.look, but the same principle applies there. Pass scalar references rather than returning values in all non-trivial cases to minimize string copying. Incidentally, you can use use vars to make variables persist between code blocks without putting them in an explicit package if desired."
I can provide more info for those who are interested.