ENH: added @ebolyen's changes