Global improvment and code cleanup.