ENH: modified the code