convert to numpy; simplify code; improve interface; improve docs