Old pre-tg code from Baystation12