Massive simplification/cleanup.