removed the last of the direct accesses, cleaned up a few functions