move some things around and add doc comments