This whole section doesn't make sense anymore and should be rewritten from scratch.