more debugging, nearly complete