Most frightening piece of code I've ever seen