Cleanup, reference fixes