Doc and refactor. Should be more obvious what is going on.