Adapt for wmflabs, factorize some code.