Programming stuff and code cleanup.