moved some more code