rewrote the internals