God this needs cleanup.