LIbrary updates and code cleanup.