[ENH] code styling , improve functionality

*closes #1354