Cleanup and removal of unused references.