More cleanup, still trying to get rid of the redundant loop.