re-written, needs docs.