ENH: address discussion, improve efficiency